package com.william.yun.yunliwuli.api.rest;

import com.alibaba.fastjson.JSONObject;
import com.william.yun.yunliwuli.api.HttpResponse;
import com.william.yun.yunliwuli.api.request.binding.BindingRequest;
import com.william.yun.yunliwuli.api.request.binding.PubBindUpdateRequest;
import com.william.yun.yunliwuli.api.response.binding.PubBindQueryResponse;
import com.william.yun.yunliwuli.service.impl.BindingServiceImpl;

/**
 * 价签
 */
public class BindingApi extends BaseApi {

    /**
     * 绑定价签
     * @param request
     * @param token
     * @return
     */
    public HttpResponse binding(BindingRequest request, String token){
        JSONObject jsonObject = new BindingServiceImpl().postBinding(getJsonParam(request), token);
        return JSONObject.toJavaObject(jsonObject, HttpResponse.class);
    }

    /**
     * 更改商品、价签、模板绑定关系
     * @param request
     * @param token
     * @return
     */
    public HttpResponse pubBindUpdate(PubBindUpdateRequest request, String token){
        JSONObject jsonObject = new BindingServiceImpl().postPubBindUpdate(getJsonParam(request), token);
        return JSONObject.toJavaObject(jsonObject, HttpResponse.class);
    }

    /**
     * 查询价签绑定信息
     * @param mac
     * @param token
     * @return
     */
    public PubBindQueryResponse pubBindQuery(String mac, String token){
        JSONObject jsonObject = new BindingServiceImpl().postPubBindQuery(mac, token);
        return JSONObject.toJavaObject(jsonObject, PubBindQueryResponse.class);
    }


}
